-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protocol Fee Table #964
Protocol Fee Table #964
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I just added some suggestions for improvements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small natspec change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// If the token has a custom fee table, find the appropriate percentage | ||
uint256 priceRangesLength = priceRanges.length; | ||
if (priceRangesLength > 0) { | ||
for (uint256 i; i < priceRangesLength; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (uint256 i; i < priceRangesLength; ++i) { | |
for (uint256 i; i < priceRangesLength - 1; ++i) { |
I guess it should give the same result saving a few instruction/gas (at least 1 if() assessment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Good catch.
*/ | ||
function setTokenPriceRanges(address _tokenAddress, uint256[] calldata _priceRanges) internal { | ||
for (uint256 i = 1; i < _priceRanges.length; ++i) { | ||
if (_priceRanges[i] < _priceRanges[i - 1]) revert NonAscendingOrder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (_priceRanges[i] < _priceRanges[i - 1]) revert NonAscendingOrder(); | |
if (_priceRanges[i] <= _priceRanges[i - 1]) revert NonAscendingOrder(); |
I don't think it makes sense to accept 2 successive ranges with the same value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix #956